var mapIds = [867202000];
var 准备地图 = 867202050;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("副本_莫奈德_Act2_探索森林七");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully();
        d.killAllMonsters(false)
    }
    c.schedule("spawnmob", 0);
    return c
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0));
    b.startEventTimer(2 * 60 * 1000);
    a.getAPI().setNumberForQuestInfo(64272, "damage", 0)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    em.setProperty("kill", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(a, b) {
    return 1
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function spawnmob(b) {
    b.schedule("spawnmob", randomNum(3, 5) * 1000);
    var e = em.getMapFactoryMap(867202000);
    var c = randomNum(1, 2);
    if (c == 1) {
        for (var a = -1000; a < randomNum(-500, 1000); a += 200) {
            var d = em.getMonster(randomNum(9402286, 9402288));
            e.spawnMonsterOnGroundBelow(d, new java.awt.Point(a, 100))
        }
    } else {
        if (c == 2) {
            for (var a = -1000; a < randomNum(-500, 1000); a += 500) {
                var d = em.getMonster(9402289);
                e.spawnMonsterOnGroundBelow(d, new java.awt.Point(a, 100))
            }
        }
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};